function findElementPosition(element, targetParentId, debug) {
	var curleft = curtop = 0;
	if (element.offsetParent) {
		curleft = element.offsetLeft;
		curtop = element.offsetTop;
		if (debug) confirm(element.offsetLeft);
		while (element = element.offsetParent) {
			if (targetParentId && element.id && element.id == targetParentId) {
				break;
		}
		if (debug) confirm(element.offsetLeft);
			curleft += element.offsetLeft;
			curtop += element.offsetTop;
		}
	}
	return {x: curleft, y: curtop};
}
